<template>
  <div class="home">
    <label>{{userinfo.name}}</label>
  </div>
</template>

<script>
// @ is an alias to /src
import { mapState } from 'vuex'

export default {
  name: 'Home',
  computed: {
    // 将vuex中的全局变量userinfo映射为组件的局部变量
    ...mapState({
      userinfo: 'userinfo'
    })
  },
  components: {

  },
  mounted() {
    console.log(this.$store.state)
    for(var key in this.$store.state){
      console.log(key)
    }
  }
}
</script>
